<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
	xmlns:cc="http://java.sun.com/jsf/composite/cc">

<ui:composition template="/WEB-INF/templates/newsmaintemplate.xhtml">
	<!-- define the title for each page -->
	<ui:define name="title">#{storeBackingBean.store.name}
	<f:event type="preRenderComponent" listener="#{storeBackingBean.loadStore()}" />
	</ui:define>
	<ui:define name="description">
		<meta name="description" content="#{storeBackingBean.store.name}"></meta>
	</ui:define>
	<ui:define name="metadata">
		<f:metadata>
			<f:viewParam name="id" value="${sessionScope.storeId}"></f:viewParam>
		</f:metadata>
	</ui:define>
	<ui:define name="leftpage">
		<ui:include src="../WEB-INF/templates/faceBookPlugin.xhtml"></ui:include>
		<!-- Store Form -->
		<h:form id="viewStoreForm" prependId="false" styleClass="whiteBackGround" target="_blank">
			<div>
				<div class="storePageInfo">
					<h:link outcome="#{storeBackingBean.store.website}" styleClass="storeInfoLeft">
						<img src="/resources/storePic/#{storeBackingBean.store.storePicturePathURL}" class="viewStorePic" />
					</h:link>
				</div>
				<div class="storeInfoRight">
					<h1 class="blue">#{storeBackingBean.store.name}</h1>
					<h:outputText value="#{storeBackingBean.store.storeDesc}" escape="false"></h:outputText>
					<br />
					<h:panelGroup rendered="#{!empty storeBackingBean.store.cashBackPercent}">
						<h1 class="blueNoWrap">#{msgs.CashBack}:</h1>
						<p class="green">
							<h:outputFormat value="#{storeBackingBean.store.cashBackPercent}">
								<f:convertNumber type="percent" maxFractionDigits="2" minFractionDigits="2"></f:convertNumber>
							</h:outputFormat>
							<a href="#cashBackDetail" title="Cash Back"></a>
						</p>
					</h:panelGroup>
					<h1 class="blue">
						<p:commandButton action="#{storeBackingBean.processGenericStoreLinkClick(storeBackingBean.store)}" value="#{msgs.Shop}" styleClass="greenButton"
							rendered="#{!empty storeBackingBean.store.genericStoreLink}" target="_blank" ajax="false">
						</p:commandButton>

						<h:panelGroup>
							<p:commandLink title="#{msgs.NoEligibleCashBack_detail}" action="#{login.forwardToLogin('/stores/viewStore.xhtml')}" ajax="false"
								rendered="#{!login.isUserLoggedIn() and storeBackingBean.store.cashBackPercent!='0.000'}">
								<h:outputText value="#{msgs.NoEligibleCashBack}" styleClass="redBold"></h:outputText>
							</p:commandLink>
							<h:outputText value="#{msgs.EligibleCashBack}" styleClass="green"
								rendered="#{login.isUserLoggedIn() and  storeBackingBean.store.cashBackPercent!='0.000'}" title="#{msgs.NoEligibleCashBack_detail}"></h:outputText>
						</h:panelGroup>
					</h1>

				</div>
			</div>
		</h:form>
		<h:form prependId="false" styleClass="whiteBackGround">
			<p:tabView orientation="top" dynamic="false" styleClass="topTabView">
				<p:tab title="#{msgs.StoreDeal}">
					<div class="storeDeals">
						<p:dataTable var="thread" value="#{storeBackingBean.latestDeals}" paginator="false" rows="30" tableStyleClass="noBorderTable"
							styleClass="datatable" rowStyleClass="whiteBackGround">
							<p:column headerText="#{msgs.Deals}" styleClass="viewStoreMainColumn">
								<h:panelGrid columns="2" columnClasses="smallCell" styleClass="noBorder">
									<h:panelGroup styleClass="thumbnail" rendered="#{!empty thread.thumbPicURL}">
										<h:link outcome="/thread/viewthread">
											<f:param name="id" value="#{thread.id}"></f:param>
											<img src="#{thread.thumbPicURL}" class="dealpicInListing" />
										</h:link>
									</h:panelGroup>
									<h:panelGroup styleClass="txt" layout="block">
										<h:link value="#{thread.subject}" outcome="/thread/viewthread" styleClass="subject">
											<f:param name="id" value="#{thread.id}"></f:param>
										</h:link>
									</h:panelGroup>
								</h:panelGrid>
							</p:column>

							<p:column headerText="#{msgs.Rating}" sortBy="#{thread.rating}" styleClass="ratingColumn">
								<h:panelGroup id="ratingGroup">
									<p:rating id="ratingId" readonly="true" stars="5" value="#{threadBackingBean.getRating(thread.id)}">
									</p:rating>
									<p:tooltip for="ratingId" showEffect="fade" id="ratingTip"
										value="Score: #{threadBackingBean.getRating(thread.id)} Votes: #{threadBackingBean.getRating(thread.id)} "></p:tooltip>
								</h:panelGroup>
							</p:column>
							<p:column headerText="#{msgs.threadReplyHitLabel}" sortBy="#{thread.numberOfReplies}">
								<h:outputText value='#{thread.numberOfReplies}/#{thread.numberOfView}' escape="false"></h:outputText>
							</p:column>
						</p:dataTable>
					</div>
				</p:tab>
				<p:tab title="#{msgs.CashBackDetail}">
					<a name="cashBackDetail"> </a>
					<h1 class="topSpace blue">Cash Back Details</h1>
					<h:outputText value="#{storeBackingBean.store.cashBackDesc}" escape="false" rendered="#{!empty storeBackingBean.store.cashBackDesc}"></h:outputText>
					<h:outputText value="#{msgs.AVAILSOON}" rendered="#{empty storeBackingBean.store.cashBackDesc}"></h:outputText>
					<div class="margintop">
						<h:outputText value="#{msgs.Note}"></h:outputText>
						<ul class="generalList">
							<li>#{msgs.CashBackNote1}</li>
						</ul>
					</div>
				</p:tab>
				<p:tab title="#{msgs.BFAD}">
					<h:outputText value="#{msgs.ComingSoon}" rendered="#{empty storeBackingBean.store.bfAdScan}"></h:outputText>
					<p:media value="/resources/bfAdScan/#{storeBackingBean.store.bfAdScan}" width="100%" height="600px"
						rendered="#{!empty storeBackingBean.store.bfAdScan}">  
  						  Your browser can't display pdf, <h:outputLink value="/resources/bfAdScan/walmartbfad.pdf">click</h:outputLink> to download pdf instead.  
					</p:media>
				</p:tab>

			</p:tabView>
		</h:form>
		<ui:include src="/ad/leaderboard.xhtml"></ui:include>


	</ui:define>
	<ui:define name="rightpage">

	</ui:define>
</ui:composition>
</html>
